#ifndef ADDFRIENDDIALOG_H
#define ADDFRIENDDIALOG_H

#include <QDialog>
#include <QWidget>

#include "model/data.h"

namespace model {
    class UserInfo;
}

class QGridLayout;
class QLineEdit;

///////////// 搜素显示好友窗口类
class AddFriendDialog : public QDialog
{
    Q_OBJECT
public:
    AddFriendDialog(QWidget* parent);

    void addResultItem(const model::UserInfo& userInfo);

    void clear();

    void setSearchText(const QString& content);

private:
    void initResultArea(QGridLayout* layout);

    void onClickedBySearchBtn();

    void searchUserDoneHandle();

private:
    QWidget* container;     // 搜素结果展示的窗口区
    QLineEdit* searchEdit;  // 搜索框
};


///////////// 搜素结果的好友控件类
class FriendResultItem : public QWidget
{
    Q_OBJECT
public:
    FriendResultItem(const model::UserInfo& userInfo);

private:
    void onClickedByAddBtn();

private:
    const model::UserInfo& userInfo;

    QPushButton* addBtn;
};


#endif // ADDFRIENDDIALOG_H
